package s0404.controller;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

/**
 * @author tg.si@188.com
 * @todo
 * @since 2024/4/6 20:52
 */
@WebServlet("/hello")
public class HelloServlet extends HttpServlet {

    @Override
    protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //        要保证Tomcat_HOME/conf/server.xml中
        //        <Connector port="8080" protocol="HTTP/1.1"
        //               connectionTimeout="20000"
        //               redirectPort="8443"
        //               URIEncoding="UTF-8"
        //               />
        //要保证项目的Global Encoding、Project Encoding和Default encoding for properties files都是UTF-8
        resp.setContentType("text/html; charset=UTF-8");
        resp.getWriter().println("您好!!");
    }
}
